package com.sora.test;

import com.sora.api.ByeService;
import com.sora.serializer.CommonSerializer;
import com.sora.transport.RpcClient;
import com.sora.transport.RpcClientProxy;
import com.sora.api.HelloObject;
import com.sora.api.HelloService;
import com.sora.transport.netty.client.NettyClient;
import com.sora.serializer.ProtobufSerializer;

/**
 * @Classname: NettyTestClient
 * @Description:
 * @Author: Stonffe
 * @Date: 2023/5/1 15:49
 */
public class NettyTestClient {
    public static void main(String[] args) {
        RpcClient client = new NettyClient(CommonSerializer.PROTOBUF_SERIALIZER);
        RpcClientProxy proxy = new RpcClientProxy(client);
        HelloService service = proxy.getProxy(HelloService.class);
        HelloObject object = new HelloObject(12, "this is a message");
        String hello = service.hello(object);
        System.out.println(hello);
        ByeService byeService = proxy.getProxy(ByeService.class);
        System.out.println(byeService.bye("netty"));
    }
}
